/**
 * @计算拥有n个元素的浮点数数组所有元素的平均值
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <cs50.h>

int main(int argc, char *argv[]) {
	float s, average, and = 0;
	int number, i;
	
	printf("请输入要计算平均数的个数：");
	scanf("%d", &number);

	float array[number];

	for (i=0; i<number; i++) {
		printf("请输入%d个数：", i+1);
		scanf("%f", &array[i]);
		and += array[i]; 
	}

	printf("%d个数的和是：%f\n", number, and);

	average = and / number;

	printf("average=%.2f\n", average);

	return 0;
}
